﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            //数组中的求和
            Queue yue1 = new Queue();

            yue1.Enqueue(985);
            yue1.Enqueue(211);
            yue1.Enqueue(666);

            object[] obj = yue1.ToArray();

            int sum = 0;
            foreach (int i in obj )
            {
                sum += i;
            }
            Console.WriteLine( sum );


            Console.WriteLine();

            //GetEnumerator() 方法来遍历
            IEnumerator enumerator = yue1 .GetEnumerator();
            while (enumerator.MoveNext())
            {
                Console.WriteLine(enumerator.Current);
            }



        }
    }
}
